package ch06;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class StudentMain {
    public static void main(String[] args) {
        Logger logger = LogManager.getLogger(StudentMain.class.getName());
        Student s1 = new Student();
        try {
            s1.setId("88012312");
            System.out.println("学号赋值正常: "+s1.getId());
            logger.info("学号赋值正常: "+s1.getId());
        } catch (Exception e) {
//            e.printStackTrace();
            logger.error("学号赋值出现异常: "+e.getMessage());
        }
        s1.setName("张三");
        try {
            s1.setAge(23);
            System.out.println("年龄赋值正常: "+s1.getAge());
            logger.info("年龄赋值正常: "+s1.getAge());
        } catch (MyException e) {
//            e.printStackTrace();
            logger.error("年龄赋值出现异常: "+e.getMessage());
        }
//        try {
//            Student s2 = new Student("2233444","里斯",12);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        System.out.println("学员注册成功！");
    }
}
